package com.education.welco.service.impl;

import com.education.common.utils.Convert;
import com.education.welco.mapper.JrOpinionMapper;
import com.education.welco.pojo.JrOpinion;
import com.education.welco.service.IJrOpinionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 意见反馈 服务层实现
 *
 * @author d
 * @date 2022-06-28
 */
@Service
public class JrOpinionServiceImpl implements IJrOpinionService {

    @Autowired
    private JrOpinionMapper jrOpinionMapper;

    /**
     * 查询意见反馈信息
     *
     * @param id 意见反馈ID
     * @return 意见反馈信息
     */
    @Override
    public JrOpinion selectJrOpinionById(Integer id) {
        return jrOpinionMapper.selectJrOpinionById(id);
    }

    /**
     * 查询意见反馈列表
     *
     * @param jrOpinion 意见反馈信息
     * @return 意见反馈集合
     */
    @Override
    public List<JrOpinion> selectJrOpinionList(JrOpinion jrOpinion) {
        return jrOpinionMapper.selectJrOpinionList(jrOpinion);
    }

    /**
     * 新增意见反馈
     *
     * @param jrOpinion 意见反馈信息
     * @return 结果
     */
    @Override
    public int insertJrOpinion(JrOpinion jrOpinion) {
        jrOpinion.setCreateTime(new Date());
        return jrOpinionMapper.insertJrOpinion(jrOpinion);
    }

    /**
     * 修改意见反馈
     *
     * @param jrOpinion 意见反馈信息
     * @return 结果
     */
    @Override
    public int updateJrOpinion(JrOpinion jrOpinion) {
        return jrOpinionMapper.updateJrOpinion(jrOpinion);
    }

    /**
     * 删除意见反馈对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteJrOpinionByIds(String ids) {
        return jrOpinionMapper.deleteJrOpinionByIds(Convert.toStrArray(ids));
    }
}